package xin.nick.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DemoController {
    @Autowired
    private UserRemoteClient userRemoteClient;
    @GetMapping("/call")
    public String callHello() {
        String result = userRemoteClient.getName();
        System.out.println("getName调用结果：" + result);
        return result;
    }

    @GetMapping("/call/userInfo")
    public String callUserInfo() {
        String result = userRemoteClient.getUseInfo("Nick", 22);
        System.out.println("getUseInfo 调用结果：" + result);
        return result;
    }

    @PostMapping("/call/userAdd")
    public String callUserAdd(@RequestBody UserInfo userInfo) {
        String result = userRemoteClient.addUser(userInfo);
        System.out.println("addUser 调用结果：" + result);
        return result;
    }

}
